#include <iostream>

using namespace std;

class Date {
public:
    int GetMonthDay(int year, int month) {
        static int monthDayArray[13] = {31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))) {
            return 29;
        } else {
            return monthDayArray[month];
        }
    }

    Date(int year = 0, int month = 1, int day = 1)
        : _year(year), _month(month), _day(day) {
        while (_day > GetMonthDay(_year,_month)) {
            _day -= GetMonthDay(_year,_month);
            ++_month;
            if (_month > 12) {
                ++_year;
                _month = 1;
            }
        }
    }
    void PrintDate() {
        printf("%04d-%02d-%02d\n", _year, _month, _day);
    }

private:
    int _year;
    int _month;
    int _day;
};

int main() {
    int year;
    int day;
    while (scanf("%d%02d", &year, &day) != EOF) {
        Date A(year, 1, day);
        A.PrintDate();
    }
    return 0;
}



